package com.kyub.dynamoscaffold

import org.codehaus.groovy.grails.scaffolding.view.*
import org.springframework.web.servlet.View
import org.codehaus.groovy.grails.commons.GrailsApplication
import org.springframework.core.io.ResourceLoader
import org.apache.commons.logging.LogFactory
import org.codehaus.groovy.grails.scaffolding.GrailsTemplateGenerator
import grails.util.GrailsUtil
import org.codehaus.groovy.grails.web.servlet.view.GroovyPageView
import org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
import org.codehaus.groovy.grails.commons.GrailsDomainClass
import org.codehaus.groovy.grails.web.util.WebUtils
import java.util.concurrent.ConcurrentHashMap

public class DynaViewResolver extends ScaffoldingViewResolver {


   static final LOG  = LogFactory.getLog(ScaffoldingViewResolver)

  protected View createScaffoldedView(String viewName, String viewCode) {

   LOG.error(viewName + " " + viewCode)

    return super.createScaffoldedView(viewName, viewCode);    //To change body of overridden methods use File | Settings | File Templates.
  }

  protected String resolveViewForController(GroovyObject controller, GrailsApplication application, String viewName, ResourceLoader resourceLoader) {

   LOG.error(controller.getClass().getName() + " " + viewName )

    return super.resolveViewForController(controller, application, viewName, resourceLoader);    //To change body of overridden methods use File | Settings | File Templates.
  }

  def View resolveViewName(String viewName, Locale locale) {

     LOG.error( viewName +" 4 resolveViewName")
    return super.resolveViewName(viewName, locale);    //To change body of overridden methods use File | Settings | File Templates.
  }

 @Override
    protected View loadView(String viewName, Locale locale) throws Exception {
       def view = super.loadView(viewName, locale)
       return view;
    }

   protected String generateViewSource(GrailsWebRequest webRequest, GrailsDomainClass domainClass) {
     def source = super.generateViewSource(webRequest, domainClass)
     return source;
    }

  
}